<?php

use App\Laravue\Acl;
use App\Laravue\Models\Permission;
use App\Laravue\Models\Role;
use Illuminate\Database\Seeder;

class createPermission extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //run php artisan db:seed --class=createPermission
        //编辑用户
        Permission::findOrCreate('查看客户','api');
        Permission::findOrCreate('管理客户','api');
        Permission::findOrCreate('审批流程','api');
        Permission::findOrCreate('管理媒介客户','api');
        Permission::findOrCreate('查看媒介客户','api');

        //Assign new permissions to admin group
        $adminRole = Role::findByName(Acl::ROLE_ADMIN);
        $adminRole->givePermissionTo(['查看客户','管理客户','审批流程','管理媒介客户','查看媒介客户']);

        //管理审核流程
        //Permission::findOrCreate('管理审核流程','api');




    }
}
